package main

import (
	"fmt"
)

func main() {
	// 一维数组
	var n [10]int
	var m = [5]int{1, 3, 5, 7, 9}
	for i := 0; i < 10; i++ {
		n[i] = i * 5
	}
	fmt.Println("m: ", m)
	fmt.Println("n: ", n)

	// 二维数组
	mm := [3][4]int{{11, 12, 13, 14}, {21, 22, 23, 24}, {31, 32, 33, 34}}
	for i := 0; i < 3; i++ {
		for j := 0; j < 4; j++ {
			fmt.Printf("mm[%d][%d] = %d\t", i, j, mm[i][j])
		}
		fmt.Println()
	}

	// 函数传数组参数
	var arr_no = []int{1, 2, 3, 4, 5, 6}
	var arr_yes = [5]int{1, 2, 3, 4, 5}
	setArray(arr_no)
	setArray2(arr_yes)

}

func setArray(arr []int) {
	fmt.Println("array: ", len(arr))
}

func setArray2(arr [5]int) {
	fmt.Println("array2: ", len(arr))
}
